package com.fhzn.boss.web.request;

import com.fhzn.commons.toolkit.exception.BuzException;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.formula.functions.T;

/**
 * @author 老顾
 * @apiNote
 * @since 2024/1/3
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class AppQueryRequest extends BaseRequest<T> {

    private Integer id;

    private String name;

    private String code;

    private Integer status;

    public void checkParams() {
        checkBaseParams();
    }

    public void rewriteParams() {
        if (StringUtils.isBlank(name)) {
            this.setName(null);
        }
        if (StringUtils.isBlank(code)) {
            this.code = null;
        }
    }

    public void checkId() {
        if (id == null) {
            throw new BuzException("id不能为空");
        }
        this.checkParams();
    }

    /**
     * 生成发往服务端的对象
     */
    @Override
    public T genServiceParam() {
        throw new UnsupportedOperationException();
    }


}
